package com.cloud.common.controller;

import com.cloud.common.bean.ResultInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 资源无效
 */
@Slf4j
@RestController
@ConditionalOnMissingClass("com.cloud.gateway.bean.GatewayInfo")
public class NotFoundController implements ErrorController {
    /**
     * 资源无效
     *
     * @return
     */
    @RequestMapping("/error")
    public ResultInfo error() {
        return ResultInfo.failure().setCode(HttpStatus.NOT_FOUND.value());
    }

    @Override
    public String getErrorPath() {
        return "/error";
    }
}
